package org.example.utils;

import java.util.Base64;

public class Base64Example {
    public static String StringToBase64(String originalString) {

        // 将字符串转换为 Base64 编码
       return Base64.getEncoder().encodeToString(originalString.getBytes());
    }
    public static String Base64ToString(String encodedString) {

        // 将 Base64 编码的字符串解码为字节数组
        byte[] decodedBytes = Base64.getDecoder().decode(encodedString);

        // 将字节数组转换为原始字符串
        return  new String(decodedBytes);


    }
}
